package com.heima.service.impl;

import com.heima.mapper.NodeMapper;
import com.heima.mapper.StatusVmMapper;
import com.heima.pojo.VendingMachine;
import com.heima.pojo.vo.StatusVmVo;
import com.heima.service.StatusVmService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
@RequiredArgsConstructor
public class StatusVmServiceImpl implements StatusVmService {


    private final StatusVmMapper statusVmMapper;

    private final NodeMapper nodeMapper;
    @Override
    public List<StatusVmVo> queryStatusVm() {
        List<StatusVmVo> statusVmVos = statusVmMapper.queryStatusVm();
        log.info("mapper中拿到的数据为:{}",statusVmVos);
        statusVmVos.forEach(statusVmVo -> {
            statusVmVo.setAddress(statusVmVo.getAreaName()+statusVmVo.getRegionName()+statusVmVo.getNodeName());
        });

        return statusVmVos;
    }
}
